#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , n(nullptr)
{
    ui->setupUi(this);
    this->setWindowTitle(tr("自主餐厅点餐系统"));
    this->menuBar()->addAction("声明");
    this->menuBar()->addAction("关于");
    connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(pushButton_clicked()));
    connect(&dc,SIGNAL(mySignal()),this,SLOT(dc_return()));
    connect(ui->pushButton_2,SIGNAL(clicked()),this,SLOT(pushButton_2_clicked()));
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::pushButton_clicked()
{
    hide();
    dc.huifu();
    dc.sum_add();
    dc.show();
}

void MainWindow::dc_return()
{
    dc.hide();
    QMessageBox::information(this,"单号",QString::number(dc.danhao()));
    show();
    qDebug()<<"单号"<<endl;
}

void MainWindow::pushButton_2_clicked()
{
   QMessageBox::information(this,"服务员：","请问你有什么要帮忙的");
}


void MainWindow::on_pushButton_3_clicked()
{
    hide();
    dc.huifu(); //恢复菜单表头
    dc.show();
}
